<template>
<div class="car-mileage-wrap">
  <WiChart  :options="options"/>
</div>
</template>
<script setup lang="ts">
import WiChart from "@/components/WiChart";
import {onMounted, ref} from "vue";
import {chartOptionFun} from "./chartOption.js"
import {biApi} from "@/views/vms-bi/biApi";
const options = ref({})


/*
* 获取数据
*
* */
const getData = ()=>{
  biApi.getMileageTop5().then((res:any[])=>{

    let xData = []
    let yData = []
    res &&  res.forEach(item=>{
      xData.push(item.car_number)
      yData.push(item.total_mileage)
    })
    options.value = chartOptionFun(xData,yData);
  })
}


onMounted(()=>{

  getData();
})
</script>
<style scoped lang="scss">
.car-mileage-wrap{
  height: 100%;
  width:100%;
}
</style>